<?php

namespace app\api\validate;


use think\Validate;

class UserCenter Extends Validate{

    /**
     * 验证规则
     */
    protected $rule = [
        'realname' => 'require',
        'idnumber' => 'require|alphaNum|length:12,20',
        'new_nickname'   =>  'require',
        'new_wechat'   =>  'require',
        'new_alipay'   =>  'require',
        'bank_card_num'   =>  'require',
        'bank_card_name'   =>  'require',
        'bank_card_address'   =>  'require',
        'level'     =>  'require|number|between:1,4',
        'old_pay_password'  =>  'number|length:6',
        'new_pay_password'  =>  'require|number|length:6',
        'old_password'      =>  'require',
        'new_password'      =>  'require',
        'avatar_url'        =>  'require'
    ];
    /**
     * 提示消息
     */
    protected $message = [
        'realname.require'  =>  '真实姓名不能为空',
        'idnumber.require'  =>  '身份证号不能为空',
        'idnumber.alphaNum'  =>  '身份证号只能是字母或数字',
        'idnumber.between'  =>  '身份证号长度不正确',
        'new_nickname.require'  =>  '新昵称不能为空',
        'new_wechat.require'  =>  '微信号不能为空',
        'new_alipay.require'  =>  '支付宝帐号不能为空',
        'bank_card_num.require'  =>  '银行卡号不能为空',
        'bank_card_name.require'  =>  '持卡人姓名不能为空',
        'bank_card_address.require'  =>  '开户行不能为空',
        'level.require' =>  '推荐等级不能为空',
        'level.number'  =>  '推荐等级只能是数字',
        'level.between' =>  '推荐等级区间为 1 ~ 4',
        'old_pay_password.require'  =>  '支付密码不能为空',
        'old_pay_password.number'  =>  '支付密码只能为数字',
        'old_pay_password.length'  =>  '支付密码长度为6',
        'new_pay_password.require'  =>  '支付密码不能为空',
        'new_pay_password.number'  =>  '支付密码只能为数字',
        'new_pay_password.length'  =>  '支付密码长度为6',
        'old_password.require'      =>  '登录密码不能为空',
        'new_password.require'      =>  '登录密码不能为空',
        'avatar_url.require'      =>  '头像不能为空',
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'realname'  => ['realname','idnumber'],
        'newnickname'   =>  ['new_nickname'],
        'new_wechat'   =>  ['new_wechat'],
        'new_alipay'   =>  ['new_alipay'],
        'new_bank_info'  =>  ['bank_card_num','bank_card_name','bank_card_address'],
        'my_team'   =>  ['level'],
        'new_pay_password'  =>  ['old_pay_password','new_pay_password'],
        'new_password'      =>  ['old_password','new_password'],
        'avatar'      =>  ['avatar_url'],
    ];
}